#include <stdio.h>
#include<string>
#include <iostream>
#include "class_test/class_factory.h"
#include "complex/complex.h"
#include "custom_complex/Complex.h"
#include "vector_test/vector_test.h"
#include "exception_test/exception_test.h"
#include "newarray_test/newarray_test.h"
#include "array_mem/array_mem.h"
using namespace std;


int main(int, char**){
    printf("Hello, from cmaketest!\n");
    Rectangle r("test",25.98,26.11);
    // Rectangle* r1 = new Rectangle("test",25.98,26.11);

    cout << "长方形"<<r.getId()<<"的面积:" << r.area()<< endl;

    const struct complex c1 = {5,7},c2={8,9};

    struct complex * p = c1 + c2;

    struct complex c3 = *p;

    cout << "c3:"<<c3.i<<"+" << c3.j<<"i"<< endl;

    delete p;

    Complex c5(5,7),c6(8,12);

    cout << "c4:"<<(c5+c6).to_string() << endl;


    vector_test();

    
    try
    {
        cout << test_divide(5,0) << endl;
    }
    catch(const MyException & e)
    {
        std::cerr << e.what() << '\n';
    }


    test_array();
    char i =0;
    int arr[] = {2,2};


    Rectangle** arr1  = (Rectangle**)newArray(r,2,arr);

   Rectangle & r2 = arr1[0][1];
//   r2 = r;
//    Rectangle * k  = new (&arr1[0][1]) Rectangle("test",25.98,26.33);
    delArray(arr1,r,2,arr);

    

   
    return 0;
}
